﻿@using KaytechSoftware.Cms.Common.Helpers
@model KaytechSoftware.Cms.App.Areas.Content.Models.PhotoGalleryModel

@if (Model.Items != null)
{
    <div class="photo-gallery">
        @foreach (var item in Model.Items)
        {
            if (item.MainPhotoId.HasValue && item.MainPhotoVersion.HasValue)
            {
                <a href="@Url.Action("Show", "PhotoAlbum", new { area = "Content", id = item.Id})">
                    <img style="float: left;" src="@PathHelper.PhotoSmallPathForWeb(item.Id, item.MainPhotoId.Value, item.MainPhotoVersion.Value)" />
                </a>    
            }
            else
            {
                <a href="@Url.Action("Show", "PhotoAlbum", new { area = "Content", id = item.Id})">
                    <img width="184" height="136" style="float: left;" src="~/Content/images/photo.jpg" />
                </a>
            }

            <article>
                <header><a href="@Url.Action("Show", "PhotoAlbum", new { area = "Content", id = item.Id})">@item.Title</a></header>
                <span>@item.Description</span>
            </article>
            <div style="clear: both;"></div>
            <br/>
        }
    </div>
}